<template>
  <div>
    <div class="pc-bg">
      <div class="pc-1 new1">
        <div style="height: 120px"></div>
        <div class="pc-11">
          <p>首页</p>
          <p>></p>
          <p>人才政策一网通查</p>
          <p>></p>
          <p>人才信息填写</p>
        </div>
      </div>
      <div class="saix" style="margin-top:30px">
        <div></div>
        <div class="saix-top">
          <p>1</p>
          <p>/ 人才信息填写</p>
        </div>
        <div class="saix-con">
          <p>您目前的状态</p>
          <div class="saix-1">
            <el-radio v-model="radio" label="1">我是求职者</el-radio>
            <el-radio v-model="radio" label="2">我是创业者</el-radio>
          </div>
        </div>
        <div class="saix-con">
          <p>意向单位</p>
          <div class="saix-1">
            <el-input
              v-model="input"
              placeholder="请输入内容"
              size="small"
            ></el-input>
          </div>
        </div>
        <div class="saix-con">
          <p>适用地区</p>
          <div class="saix-2">
            <div>
              <el-select v-model="value" placeholder="请选择" size="small">
                <el-option
                  v-for="item in []"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
            <div>
              <el-select v-model="value1" placeholder="请选择县区" size="small">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
          </div>
        </div>
        <div class="saix-con">
          <p>年龄</p>
          <div class="saix-1">
            <div>
              <el-select v-model="value2" placeholder="请选择" size="small">
                <el-option
                  v-for="item in daweiList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
          </div>
        </div>
        <div class="saix-con">
          <p>国籍</p>
          <div class="saix-1">
            <el-radio v-model="radio" label="1">中国</el-radio>
            <el-radio v-model="radio" label="2">外国</el-radio>
          </div>
        </div>
        <div class="saix-con">
          <p>最高学历</p>
          <div class="saix-1">
            <el-radio v-model="radio" label="1">大专</el-radio>
            <el-radio v-model="radio" label="2">本科</el-radio>
            <el-radio v-model="radio" label="3">硕士</el-radio>
            <el-radio v-model="radio" label="4">博士</el-radio>
          </div>
        </div>
        <div class="saix-con">
          <p>是否有海外经历</p>
          <div class="saix-1">
            <el-radio v-model="radio" label="1">有海外学习经历</el-radio>
            <el-radio v-model="radio" label="2">无</el-radio>
          </div>
        </div>
        <div class="saix-con">
          <p>人才类型</p>
          <div class="saix-1">
            <el-checkbox-group v-model="checkList">
              <el-checkbox label="科技类"></el-checkbox>
              <el-checkbox label="重点产业紧缺类"></el-checkbox>
              <el-checkbox label="高级能类"></el-checkbox>
              <el-checkbox label="教育类"></el-checkbox>
              <el-checkbox label="卫生类"></el-checkbox>
            </el-checkbox-group>
          </div>
        </div>
        <div class="saix-bot">
          <p>提交并匹配</p>
        </div>
      </div>
      <div class="pc-2">
        <div class="saix-top">
          <p>2</p>
          <p>/ 智能匹配报告</p>
        </div>
        <div class="pc-20">
          <p>人才政策类型</p>
          <div>
            <p @click="onTab(0)" :class="{ on: curIndex == 0 }">所有（0）</p>
            <p @click="onTab(1)" :class="{ on: curIndex == 1 }">
              人才激励（1）
            </p>
            <p @click="onTab(2)" :class="{ on: curIndex == 2 }">
              人才培养（1）
            </p>
            <p @click="onTab(3)" :class="{ on: curIndex == 3 }">
              人才引进（1）
            </p>
            <p @click="onTab(4)" :class="{ on: curIndex == 4 }">
              人才补贴（1）
            </p>
            <p @click="onTab(5)" :class="{ on: curIndex == 5 }">
              荣誉资质（1）
            </p>
            <p @click="onTab(6)" :class="{ on: curIndex == 6 }">
              薪酬补贴（1）
            </p>
            <p @click="onTab(7)" :class="{ on: curIndex == 7 }">
              金融支持（1）
            </p>
          </div>
        </div>
        <div class="pc-22">
          <div v-for="(item, index) in list" :key="index" class="list" @click="onSee(item)">
            <div class="list-1">
              <div>
                <p>{{ item.policyLevel == 1 ? "市级" : "区县" }}</p>
                <p></p>
                <p>{{ item.title }}</p>
              </div>
              <div class="list-11">
                <p>推荐指数</p>
                <div v-for="(i, index) in 5" :key="index">
                  <img
                    v-if="item.recRating >= index"
                    src="../../assets/news/7.png"
                    alt=""
                  />
                  <img v-else src="../../assets/news/6.png" alt="" />
                </div>
              </div>
            </div>
            <div class="list-3" style="margin-top=20px">
              <p>申报时间：{{ item.beginTime }} 至 {{ item.endTime }}</p>
              <p>发文单位：{{ item.pubishBy }}</p>
              <p>扶持资金：{{ item.fundScope }}</p>
            </div>
            <div class="list-4">
              <div>
                <img src="../../assets/news/5.png" alt="" />
                <p>{{ item.pubdate }}</p>
              </div>
              <div>
                <div>
                  <img src="../../assets/news/6.png" alt="" v-if="scState" />
                  <img src="../../assets/news/7.png" alt="" v-else />
                  <p>收藏</p>
                </div>
                <div>
                  <img src="../../assets/news/6.png" alt="" v-if="scState" />
                  <img src="../../assets/news/7.png" alt="" v-else />
                  <p>订阅</p>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="pc-23">
          <el-pagination
            background
            layout="prev, pager, next"
            :total="total"
            prev-text="上一页"
            next-text="下一页"
            :page-size="pageSize"
            :current-page="currentPage"
            @current-change="handleCurrentChange"
          >
          </el-pagination>
        </div>
      </div>
      <div class="pc-2">
        <div class="pc-21">
          <div>
            <p>推荐政策</p>
            <!-- <p>查看更多>></p> -->
          </div>
        </div>
        <div class="pc-22">
          <div v-for="(item, index) in tjList" :key="index" class="list" @click="onSee(item)">
            <div class="list-1">
              <div>
                <p>{{ item.policyLevel == 1 ? "市级" : "区县" }}</p>
                <p></p>
                <p>{{ item.title }}</p>
              </div>
              <img
                v-if="item.stateSb == 1"
                src="../../assets/news/3.png"
                alt=""
              />
              <img v-else src="../../assets/news/4.png" alt="" />
            </div>
            <div class="list-2">
              <p v-for="(item, index) in item.policyLabelList" :key="index">
                {{ item }}
              </p>
            </div>
            <div class="list-3">
              <p>申报时间：{{ item.beginTime }} 至 {{ item.endTime }}</p>
              <p>发文单位：{{ item.pubishBy }}</p>
              <p>扶持资金：{{ item.fundScope }}</p>
            </div>
            <div class="list-4">
              <div>
                <img src="../../assets/news/5.png" alt="" />
                <p>{{ item.pubdate }}</p>
              </div>
              <div>
                <div>
                  <img src="../../assets/news/6.png" alt="" v-if="scState" />
                  <img src="../../assets/news/7.png" alt="" v-else />
                  <p>收藏</p>
                </div>
                <div>
                  <img src="../../assets/news/6.png" alt="" v-if="scState" />
                  <img src="../../assets/news/7.png" alt="" v-else />
                  <p>订阅</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="pc-24"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "app",
  data() {
    return {
      input: "",
      value: "连云港市",
      value1: "",
      scState: false,
      radio: "1",
      checkList: ["科技类"],
      curIndex: 0,
      options: [
        {
          value: "选项1",
          label: "海州区"
        },
        {
          value: "选项2",
          label: "连云区"
        }
      ],
      value2: "",
      daweiList: [
        {
          value: "选项1",
          label: "20-30周岁"
        },
        {
          value: "选项2",
          label: "30-35周岁"
        }
      ],
      pageSize: 2,
      currentPage: 1,
      total: 0,
      list: [],
      tjList: []
    };
  },
  mounted() {
    this.getPolicyList();
    this.getPolicyListTuijian();
  },
  methods: {
    onTab(ind) {
      this.curIndex = ind;
    },
    async getPolicyList() {
      const res = await this.$store.dispatch("user/getPolicyList", {
        pageNum: this.currentPage,
        pageSize: 4
      });
      console.log(res);
      this.list = res.rows;
      this.list.forEach((item, index) => {
        item.policyLabelList = item.policyLabel.split(",");
        let date1 = Date.parse(item.beginTime);
        let date2 = Date.parse(new Date());
        let date3 = Date.parse(item.endTime);
        if (date2 > date1 && date2 < date3) {
          item.stateSb = 1;
        } else {
          item.stateSb = 2;
        }
      });
      this.total = res.total;
    },
    async getPolicyListTuijian() {
      const res = await this.$store.dispatch("user/getPolicyList", {
        pageNum: 1,
        pageSize: 2
      });
      this.tjList = res.rows;
      this.tjList.forEach((item, index) => {
        item.policyLabelList = item.policyLabel.split(",");
        let date1 = Date.parse(item.beginTime);
        let date2 = Date.parse(new Date());
        let date3 = Date.parse(item.endTime);
        if (date2 > date1 && date2 < date3) {
          item.stateSb = 1;
        } else {
          item.stateSb = 2;
        }
      });
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getPolicyList();
    },
    onSee(param) {
      console.log(param);
      this.$router.push({
        path: "/index/des",
        query: {
          des: JSON.stringify(param)
        }
      });
    }
  }
};
</script>

<style lang="scss">
@import "./index.scss";
</style>
